#include<bits/stdc++.h>
using namespace std;
bool isleapyear(int year)
{
   if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
   {
       return true;
   }
    else
   {
       return false;
   }
}
int main()
{
    int a,b,c;
    scanf("%d/%d/%d",&a,&b,&c);
    int M[]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
    for(int year = 1960; year <= 2059; year++)
        {
            if(isleapyear(year))
            {
                M[2] = 29;
            }
            else
            {
                M[2] = 28;
            }
            for(int month = 1; month <= 12; month++)
                {
                    for(int day = 1; day <= M[month]; day++)
                        {
                            if((a == year%100 && b == month && day == c)
                                || (a == month && b == day && c == year%100)
                                || (a == day && b == month && c == year%100))
                            {
                                printf("%d-%02d-%02d\n",year,month,day);
                            }
                        }
                }
        }
    return 0;
}
